package com.nuoniu.sibanyun.mapper.erp;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nuoniu.sibanyun.entity.erp.ErpSaleType;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 小啊刚
 * @since 2020-12-08
 */
public interface ErpSaleTypeMapper extends BaseMapper<ErpSaleType> {

    @Select("select * form scb_sale_type where name=#{name}")
    ErpSaleType getByName(ErpSaleType erpSaleType);

    @Update("update scb_sale_type set is_default_value = 0 where account_id=#{currentAccountId}")
    void updateDefaultValue(Integer currentAccountId);

    @Select("select count(1) from scb_sale_type where style_id=#{id} and account_id=#{accountId}")
    Integer getByStyle(Long id, Integer accountId);
}
